<template>
  <!--  职业类型，未解锁      -->
  <view class="allContainer">
    <view class="maskBox" />
    <image class="textImg" :src="partTextImgUrl" />
    <image class="imgFloatRight" :src="imgPavilion" />
    <view
      class="contentView"
      :style="[{ paddingLeft: '32rpx' }, { paddingRight: '32rpx' }]"
    >
      <view class="contentBack">
        <view
          :style="[
            { marginTop: '33rpx' },
            { display: 'flex' },
            { alignItems: 'center' },
          ]"
        >
          <view class="blackBox"> </view>
          <view>
          <span
            :class="titleItem.color == 1 ? 'smallTitleGreen' : 'smallTitleRed'"
            v-for="(titleItem, titleIndex) in careerCategory.title"
            :key="titleIndex"
            >{{ titleItem.label }}</span
          >
          </view>
        </view>

        <view style="margin: 28rpx 34rpx">
          <span
            :class="
              subTitleItem.color == 1 ? 'smallTitleGreen' : 'smallTitleRed'
            "
            style="font-size: 28rpx"
            v-for="(subTitleItem, subTitleIndex) in careerCategory.subTitle"
            :key="subTitleIndex"
            >{{ subTitleItem.label }}</span
          >
        </view>
        <image class="purpleLine" :src="purpleLine"></image>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  // components: {},
  props: {
    itemIndex: {
      type: Number,
      default: 0,
    },

    isShowBgColor: {
      type: Boolean,
      default: false,
    },

    textImgWidthRpx: {
      type: Number,
      default: 271,
    },

    textImgHeightRpx: {
      type: Number,
      default: 38,
    },

    contentPaddingLeftRpx: {
      type: Number,
      default: 48,
    },

    contentPaddingRightRpx: {
      type: Number,
      default: 200,
    },

    partTextImgUrl: {
      type: String,
      default:
        "https://img3.job1001.com/ypMp/elan/images/career/careerAssessNew/title5.png",
    },

    careerCategory: {
      type: Object,
      default() {
        return {
          title: [
            { color: "1", label: "毕方陪你漫游" },
            { color: "2", label: "自我探索的神秘之境" },
          ],

          subTitle: [
            { color: "1", label: "以下列举了" },
            { color: "2", label: "适合你的职业：" },
          ],
        };
      },
    },
  },
  data() {
    return {
      currentIndex: 0,
      purpleLine: this.$imgBaseSelf + "career/careerAssessNew/purpleLine.png",
      imgPavilion:
        "https://img3.job1001.com/ypMp/elan/images/career/careerAssessNew/sunCloud.png",
    };
  },
  watch: {
    itemIndex: {
      handler(val) {
        this.currentIndex = val;
      },
      deep: true, // 深度监听
      immediate: true, // 初始化的时候立刻执行一次
    },
  },
  onReady() {},

  mounted() {
    uni
      .createSelectorQuery()
      .in(this)
      .select(".allContainer")
      .boundingClientRect((rect) => {
        console.log("rect.height = " + rect.height);
        this.$emit("listenRect", rect, this.currentIndex);
      })
      .exec();
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.allContainer {
  position: relative;
  height: 500rpx;
  width: 100%;
  // background-size: 100% auto;
  // background-image: url($img-base + "career/careerAssessResult/bg_part1.png");
  // background-repeat: no-repeat;
  //background-color: #D9E2CC;
}

.maskBox {
  width: 750rpx;
  height: 410rpx;
  position: absolute;
  bottom: 90rpx;
  //bottom:0;
  z-index: 2;
  background-image: linear-gradient(#00000000, #c6d8c0);
}

.contentView {
  z-index: 1;
  position: absolute;
  width: 100%;
  // padding-left: 48rpx;
  // padding-right: 200rpx;
  //  background-size: 380rpx 277rpx;
  // background-image: url($img-base + "career/careerAssessResult/img_pavilion.png");
  // background-repeat: no-repeat;
  //background-position: top right;
}
.contentBack {
  position: relative;
  width: 100%;
  margin-top: -10rpx;
  background: linear-gradient(
    to bottom,
    #fbdefe 0%,
    #fff3f4 50rpx,
    #f6f4df 80rpx,
    #f9f7e5 100%
  );
  padding: 20rpx 0 0 0;
  border-radius: 0 15rpx 15rpx 15rpx;
}
.textImg {
  height: 130rpx;
  width: 690rpx;
  image-rendering: -webkit-optimize-contrast;
  z-index: 9;
  position: relative;
}

.smallTitleGreen {
  font-size: 34rpx;
  font-family: Source Han Sans CN;
  font-weight: bold;
  color: #000;
  //line-height: 120rpx;
}

.smallTitleRed {
  font-size: 34rpx;
  font-family: Source Han Sans CN;
  font-weight: bold;
  color: #ed5c22;
  //	line-height: 120rpx;
}
.imgFloatRight {
  position: absolute;
  width: 272rpx;
  height: 142rpx;
  right: 0rpx;
  top: 148rpx;
  z-index: 9;
}
.blueBox {
  width: 26rpx;
  height: 20rpx;
  background: linear-gradient(to right, #d090e2 0%, #f9f7e5 100%);
  margin-top: 10rpx;
  margin-right: 10rpx;
}
.blackBox {
  content: "";
  width: 10rpx;
  max-width: 10rpx;
  height: 38rpx;
  margin-top: 6rpx;
  margin-right: 20rpx;
  background: #000;
  color: #000;
  font-size: 26rpx;
}
.purpleLine {
  width: 100%;
  height: 120rpx;
  margin-top: -28rpx;
}
.onePartContent {
  font-size: 28rpx;
  //color: #555555;
  margin-top: 47rpx;
  line-height: 37rpx;
  letter-spacing: 0rpx;

  background-clip: text;
  white-space: normal;
  word-break: break-all;

  color: transparent;
  display: -webkit-box;
  background-image: linear-gradient(#555555, #ff000000);
  -webkit-box-orient: vertical;
  /*设置省略号在容器第2行文本后*/
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
